/*********************************************************************************
 *      Copyright:  (C) 2020 makun<1394987689@qq.com>
 *                  All rights reserved.
 *
 *       Filename:  get_time.c
 *    Description:  This file 
 *                 
 *        Version:  1.0.0(2020年04月28日)
 *         Author:  makun <1394987689@qq.com>
 *      ChangeLog:  1, Release initial version on "2020年04月28日 22时13分32秒"
 *                 
 ********************************************************************************/
#include "get_time.h"

/* description: get time 
 *  input args: $datatime:save time(year,mon,hour,min,sec)
 *return value: return 6 array size
*/
int get_time(char  *datatime)
{
    struct tm *p;//p为一个指向tm结构体类型的指针

    time_t timep;
    time(&timep);
    p=localtime(&timep);
    datatime[0] = p->tm_year;
    
    datatime[1] = p->tm_mon+1;
    datatime[2] = p->tm_mday;
    datatime[3] = p->tm_hour;
    datatime[4] = p->tm_min;
    datatime[5] = p->tm_sec;

    return 6 ; 
}


